<!--<!DOCTYPE html>-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户管理</title>
    <link href="../../css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../../js/jquery.js"></script>
    <script type="text/javascript" src="../../js/market/customer/customList.js"></script>
    <script type="text/javascript">
        function tipOpen(content) {
            $(".tipright p").text(content);
            $("#tip").fadeIn(200);

        }

        function tipClose() {
            $("#tip").fadeOut(200);
            var custName002 = JSON.parse(sessionStorage.getItem("custName002"));
            var mesg02 = sessionStorage.getItem("mesg01");

            if (mesg02 == "0") {
                $.ajax({
                    url: "/market/customer/logout/" + custName002,      //请求接口的地址
                    type: "GET",
                    data: {},
                    dataType: "json",
                    success: function (res) {
                        if (res != null)
                            alert("注销成功")
                    }, error: function (r) {
                        alert("注销成功")
                        window.location.href = 'customerList.html'
                    }
                })
            } else {
                var custName002 = JSON.parse(sessionStorage.getItem("custName002"));
                $.ajax({
                    url: "/market/customer/refresh/" + custName002,      //请求接口的地址
                    type: "GET",
                    data: {},
                    dataType: "json",
                    success: function (res) {
                        if (res != null)
                            alert("恢复成功")
                    }, error: function (r) {
                        alert("恢复成功")
                        window.location.href = 'customerList.html'
                    }
                })
            }

        }

        function tipClose02() {
            $("#tip").fadeOut(200);

        }

        function allottipOpen() {
            $("#allottip").fadeIn(200);
            $.ajax({
                url: "/market/customer/distribute",      //请求接口的地址
                type: "GET",
                data: {},
                dataType: "json",
                success: function (res) {
                    $("#marketMember").html("")
                    var st1 = "<option>请选择</option>";
                    $("#marketMember").append(st1);
                    for (var i in res) {
                        // alert(res[i].cname)
                        var tr1 = "<option>" + res[i].uname + "</option>";
                        $("#marketMember").append(tr1);
                    }
                }
            })
        }

        function allottipclose() {
            $("#allottip").fadeOut(200);
           var marketMeber01= $("#marketMember option:selected").text()
           var custname = JSON.parse(sessionStorage.getItem("custname"));
            $.ajax({
                url: "/market/customer/updateDistribute" ,      //请求接口的地址
                type: "GET",
                data: {
                    "customname": custname,
                    "servicePerson":marketMeber01

                },
                dataType: "json",
                success: function (res) {
                    alert(res)
                    console.log(res)
                }, error: function (r) {
                    alert("分配成功")
                    window.location.href = 'customerList.html'
                }
            })

        }

        function allottipclose01(){
            $("#allottip").fadeOut(200);
        }
        function allottipclose02(){
            $("#allottip").fadeOut(200);
        }
    </script>
</head>

<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li>营销管理</li>
        <li>客户管理</li>
        <li>基本内容</li>
    </ul>
</div>
<div class="rightinfo">
    <form action="" method="post">
        <ul class="tools">
            <li> 公司名称:
                <input type="text" size="12" id="companyName"/>
            </li>
            <li> 客户姓名:
                <input type="text" size="12" id="customerName"/>
            </li>
            <li> 所属区域：
                <select id="province">
                    <option>请选择省份</option>
                    <option>江西</option>
                    <option>江苏</option>
                    <option>广东</option>
                    <option>安徽</option>
                    <option>浙江</option>
                </select>
                <select id="city1">
                    <option>请选择城市</option>
                </select>
            </li>
            <li> 状态：
                <select id="status01">
                    <option>请选择</option>
                    <option value="可用">可用</option>
                    <option value="不可用">不可用</option>
                </select>
            </li>
            <li> 是否分配：
                <select id="distribute01">
                    <option>请选择</option>
                    <option value="已分配">已分配</option>
                    <option value="未分配">未分配</option>
                </select>
            </li>
            <li class="subBut" id="selectMoreCondition"><img src="../../images/t06.png"/>查询
            </li>
            <li class="subBut" onclick="window.location.href='customerAdd.html'"><img src="../../images/t01.png"/>添加
            </li>
        </ul>
        <table class="tablelist">
            <thead>
            <tr>
                <th>序号</th>
                <th>客户姓名</th>
                <th>性别</th>
                <th>联系电话</th>
                <th>所属公司</th>
                <th>所属区域</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>创建人</th>
                <th>分配时间</th>
                <th>客户人员</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="tbList">
            </tbody>
        </table>
        <div class="pagin">
            <div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
            <ul class="paginList">
<!--                <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>-->
<!--                <li class="paginItem"><a href="javascript:;">1</a></li>-->
<!--                <li class="paginItem current"><a href="javascript:;">2</a></li>-->
<!--                <li class="paginItem"><a href="javascript:;">3</a></li>-->
<!--                <li class="paginItem"><a href="javascript:;">4</a></li>-->
<!--                <li class="paginItem"><a href="javascript:;">5</a></li>-->
<!--                <li class="paginItem more"><a href="javascript:;">...</a></li>-->
<!--                <li class="paginItem"><a href="javascript:;">10</a></li>-->
<!--                <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>-->
            </ul>
        </div>
    </form>
    <!-- 提示框 -->
    <div id="tip" class="tip">
        <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
        <div class="tipinfo"><span><img src="../../images/ticon.png"/></span>
            <div class="tipright">
                <p></p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite></div>
        </div>
        <div class="tipbtn">
            <input name="" type="button" class="sure" value="确定" onclick="tipClose()"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="tipClose02()"/>
        </div>
    </div>
    <!-- 审批提示框 -->
    <div id="allottip" class="tip">
        <div class="tiptop">
            <span>提示信息</span><a onclick="allottipclose01()"></a>
        </div>
        <div class="tipinfo1">

            部门：
            <select class="dfselect" disabled="disabled">
                <option>请选择</option>
                <option selected="selected">市场部</option>
                <option>采购部</option>
                <option>财务部</option>
            </select>
            <p/>
            职位：
            <select class="dfselect">
                <option>请选择</option>
                <option selected="selected">市场部组员</option>
            </select>
            <p/>
            姓名：
            <select class="dfselect" id="marketMember">
                <option>请选择</option>
<!--                <option>刘备</option>-->
<!--                <option>曹操</option>-->
            </select>
            <p/>
        </div>
        <div class="tipbtn">
            <input name="" type="button" class="sure" value="确定"  onclick="allottipclose()" />
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="allottipclose02()"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
